﻿using System.Collections.Generic;
using System.Domain.Entity;
using System.Domain.IRepository;
using Application.Infrastructure;
using Domain.Infrastructure;

namespace System.Application
{
    /// <summary>
    ///用户表服务 
    /// </summary>	
    public class SysUserService : BaseService_C_M_D<SysUserEntity>
    {
        private readonly ISysUserRepository _repository;
        public SysUserService(ILog log, ISysUserRepository repository) : this(log, repository,"")
        { 
        }
        public SysUserService(ILog log, ISysUserRepository repository, string userId) : base(log, repository, userId)
        {
            _repository = repository;
        }
         

        public List<SysUserEntity> GetList(Pagination pagination, string companyId, string departmentId, string positionId, string userId)
        {
            try
            {
                return _repository.GetList(pagination, companyId, departmentId, positionId, userId);

            }
            catch (Exception ex)
            {
                Log.Error(ex);
                throw;
            }
        }

        public bool RevisePassword(string keyValue, string userPassword)
        {
            try
            {
                return _repository.RevisePassword(keyValue, userPassword);

            }
            catch (Exception ex)
            {
                Log.Error(ex);
                throw;
            }
        }

        public SysUserEntity Login(string username, string password)
        {
            try
            {
                return _repository.Login(username, password);

            }
            catch (Exception ex)
            {
                Log.Error(ex);
                throw;
            }
        }


       
    }
}
